home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-11-19 | 1.9 KB | 74 lines | [TEXT/MPS ] |
- UNIT Where;
-
- (* The following MPW commands will build the dcmd and copy it to the
- "Debugger Prefs" file in the System folder. The dcmd's name in
- MacsBug will be the name of the file built by the Linker.
-
- Pascal Where.p
- Link dcmdGlue.a.o Where.p.o {Libraries}Runtime.o -o Where
- BuildDcmd Where 102
- Echo 'include "Where";' | Rez -a -o "{systemFolder}Debugger Prefs"
- *)
-
- {$R-}
-
- INTERFACE
-
- USES MemTypes, dcmd;
-
- { Public declaration for dcmdGlue. Must be in every dcmd. The name cannot be changed. }
- PROCEDURE CommandEntry (paramPtr: dcmdBlockPtr);
-
-
- IMPLEMENTATION
-
- CONST CR = $0D;
-
-
- PROCEDURE CommandEntry (paramPtr: DCmdBlockPtr);
- VAR address: LONGINT;
- ch: CHAR;
- ok: BOOLEAN;
- name: Str255;
- BEGIN
- IF paramPtr^.request = dcmdInit THEN
- BEGIN { The dcmd gets called once when loaded to init itself }
- END
- ELSE
- IF paramPtr^.request = dcmdDoIt THEN
- BEGIN { Do the command's normal function }
- IF dcmdPeekAtNextChar = CHR(CR) THEN
- address := paramPtr^.registerFile^[PCRegister]
- ELSE
- BEGIN
- ch := dcmdGetNextExpression (address, ok);
- IF NOT ok THEN
- BEGIN
- dcmdDrawLine ('Syntax error');
- Exit (CommandEntry);
- END;
- END;
- IF (address >= $0000A000) AND (address <= $0000ABFF) THEN
- BEGIN
- dcmdGetTrapName (address, name);
- dcmdDrawLine (name);
- END
- ELSE
- BEGIN
- dcmdGetNameAndOffset (address, name);
- IF Length (name) > 0
- THEN dcmdDrawLine (name)
- ELSE dcmdDrawLine ('No procedure name found');
- END;
- END
- ELSE
- IF paramPtr^.request = dcmdHelp THEN
- BEGIN { Display the command's help information }
- dcmdDrawLine ('WHERE [addr | trap]');
- dcmdDrawLine (' Display information about the address or trap');
- dcmdDrawLine (' If no parameter then use PC as the address');
- END;
- END;
-
- END.
-